home *** CD-ROM | disk | FTP | other *** search
/ Developer CD Series 1995 June: Reference Library / Dev.CD Jun 95 / Dev.CD Jun 95.toast / What's New? / New System Software Extensions / QuickDraw 3D ß / Programming / Interfaces / QD3DView.h < prev    next >
Encoding:
C/C++ Source or Header  |  1995-04-04  |  12.2 KB  |  395 lines  |  [TEXT/MPS ]

  1. /******************************************************************************
  2.  **                                                                          **
  3.  **     Module:        QD3DView.h                                                 **
  4.  **                                                                          **
  5.  **                                                                          **
  6.  **     Purpose:     View types and routines                                     **
  7.  **                                                                          **
  8.  **                                                                          **
  9.  **     Copyright (C) 1992-1995 Apple Computer, Inc.  All rights reserved.     **
  10.  **                                                                          **
  11.  **                                                                          **
  12.  *****************************************************************************/
  13. #ifndef QD3DView_h
  14. #define QD3DView_h
  15.  
  16. #if PRAGMA_ONCE
  17.     #pragma once
  18. #endif
  19.  
  20. #include "QD3DStyle.h"
  21. #include "QD3DSet.h"
  22.  
  23. #ifdef __cplusplus
  24. extern "C" {
  25. #endif    /* __cplusplus */
  26.  
  27.  
  28. /******************************************************************************
  29.  **                                                                             **
  30.  **                        View Type Definitions                                 **
  31.  **                                                                             **
  32.  *****************************************************************************/
  33.  
  34. typedef enum TQ3ViewStatus {
  35.     kQ3ViewStatusDone,
  36.     kQ3ViewStatusRetraverse,
  37.     kQ3ViewStatusError,
  38.     kQ3ViewStatusCancelled
  39. } TQ3ViewStatus;
  40.  
  41.  
  42. /******************************************************************************
  43.  **                                                                             **
  44.  **                        Default Attribute Set                                 **
  45.  **                                                                             **
  46.  *****************************************************************************/
  47.  
  48. #define kQ3ViewDefaultAmbientCoefficient    1.0
  49. #define kQ3ViewDefaultDiffuseColor            0.5, 0.5, 0.5
  50. #define kQ3ViewDefaultSpecularColor            0.5, 0.5, 0.5
  51. #define kQ3ViewDefaultSpecularControl        4.0
  52. #define kQ3ViewDefaultEmittedColor            0.0, 0.0, 0.0
  53. #define kQ3ViewDefaultTransparency            1.0, 1.0, 1.0
  54.  
  55. #define kQ3ViewDefaultSubdivisionMethod        kQ3SubdivisionMethodConstant
  56. #define kQ3ViewDefaultSubdivisionC1            10.0
  57. #define kQ3ViewDefaultSubdivisionC2            10.0
  58.  
  59. /******************************************************************************
  60.  **                                                                             **
  61.  **                            View Routines                                      **
  62.  **                                                                             **
  63.  *****************************************************************************/
  64.  
  65. EXPORT TQ3ViewObject Q3View_New(
  66.     void);
  67.  
  68. #if defined(ESCHER_VER_15) && ESCHER_VER_15
  69.  
  70. EXPORT TQ3ObjectType Q3View_GetType(
  71.     TQ3ViewObject        view);
  72.     
  73. #endif  /*  ESCHER_VER_15  */
  74.  
  75. /******************************************************************************
  76.  **                                                                             **
  77.  **                        View Rendering routines                                 **
  78.  **                                                                             **
  79.  *****************************************************************************/
  80.  
  81. EXPORT TQ3Status Q3View_SetRendererByType(
  82.     TQ3ViewObject         view,
  83.     TQ3ObjectType         type);
  84.     
  85. EXPORT TQ3Status Q3View_SetRenderer(
  86.     TQ3ViewObject         view,
  87.     TQ3RendererObject    renderer);
  88.  
  89. EXPORT TQ3Status Q3View_GetRenderer(
  90.     TQ3ViewObject        view,
  91.     TQ3RendererObject    *renderer);
  92.     
  93. EXPORT TQ3Status Q3View_StartRendering(
  94.     TQ3ViewObject         view);
  95.     
  96. EXPORT TQ3ViewStatus Q3View_EndRendering(
  97.     TQ3ViewObject         view);
  98.  
  99. EXPORT TQ3Status Q3View_CancelRendering(
  100.     TQ3ViewObject        view);
  101.  
  102. /******************************************************************************
  103.  **                                                                             **
  104.  **                        View/Bounds/Pick routines                             **
  105.  **                                                                             **
  106.  *****************************************************************************/
  107.  
  108. EXPORT TQ3Status Q3View_StartBoundingBox(
  109.     TQ3ViewObject        view,
  110.     TQ3ComputeBounds    computeBounds);
  111.  
  112. EXPORT TQ3ViewStatus Q3View_EndBoundingBox(
  113.     TQ3ViewObject        view,
  114.     TQ3BoundingBox        *result);
  115.  
  116. EXPORT TQ3Status Q3View_StartBoundingSphere(
  117.     TQ3ViewObject        view,
  118.     TQ3ComputeBounds    computeBounds);
  119.  
  120. EXPORT TQ3ViewStatus Q3View_EndBoundingSphere(
  121.     TQ3ViewObject        view,
  122.     TQ3BoundingSphere    *result);
  123.  
  124. EXPORT TQ3Status Q3View_StartPicking(
  125.     TQ3ViewObject        view,
  126.     TQ3PickObject        pick);
  127.  
  128. EXPORT TQ3ViewStatus Q3View_EndPicking(
  129.     TQ3ViewObject        view);
  130.  
  131. /******************************************************************************
  132.  **                                                                             **
  133.  **                            View/Camera routines                             **
  134.  **                                                                             **
  135.  *****************************************************************************/
  136.  
  137. EXPORT TQ3Status Q3View_GetCamera(
  138.     TQ3ViewObject        view,
  139.     TQ3CameraObject        *camera);
  140.  
  141. EXPORT TQ3Status Q3View_SetCamera(
  142.     TQ3ViewObject        view,
  143.     TQ3CameraObject        camera);
  144.  
  145. #if defined(ESCHER_VER_15) && ESCHER_VER_15
  146. /******************************************************************************
  147.  **                                                                             **
  148.  **                            View/Shader routines                             **
  149.  **                                                                             **
  150.  *****************************************************************************/
  151.  
  152. EXPORT TQ3Status Q3View_SetBackgroundShader(
  153.     TQ3ViewObject        view,
  154.     TQ3ShaderObject        backgroundShader);
  155.     
  156. EXPORT TQ3Status Q3View_GetBackgroundShader(
  157.     TQ3ViewObject        view,
  158.     TQ3ShaderObject        *backgroundShader);
  159.  
  160. EXPORT TQ3Status Q3View_SetAtmosphericShader(
  161.     TQ3ViewObject        view,
  162.     TQ3ShaderObject        atmospheric);
  163.  
  164. EXPORT TQ3Status Q3View_GetAtmosphericShader(
  165.     TQ3ViewObject        view,
  166.     TQ3ShaderObject        *atmospheric);
  167.  
  168. EXPORT TQ3Status Q3View_SetForegroundShader(
  169.     TQ3ViewObject        view,
  170.     TQ3ShaderObject        imagePlaneShader);
  171.  
  172. EXPORT TQ3Status Q3View_GetForegroundShader(
  173.     TQ3ViewObject        view,
  174.     TQ3ShaderObject        *imagePlaneShader);
  175.     
  176. #endif  /*  ESCHER_VER_15  */
  177.  
  178. /******************************************************************************
  179.  **                                                                             **
  180.  **                            View/Lights routines                             **
  181.  **                                                                             **
  182.  *****************************************************************************/
  183.  
  184. EXPORT TQ3Status Q3View_SetLightGroup(
  185.     TQ3ViewObject        view,
  186.     TQ3GroupObject        lightGroup);
  187.  
  188. EXPORT TQ3Status Q3View_GetLightGroup(
  189.     TQ3ViewObject        view,
  190.     TQ3GroupObject        *lightGroup);
  191.  
  192. /******************************************************************************
  193.  **                                                                             **
  194.  **        Idle Method                                                             **
  195.  **                                                                             **
  196.  **        These allow the application to register callback routines which will **
  197.  **        be called by the view during especially long operations.             **
  198.  **                                                                             **
  199.  **        These are used to interrupt long renderings or traversals.  Inside   **
  200.  **        the idler callback the application can check for command-period or      **
  201.  **        whatever else they may be using to let the user interrupt rendering. **
  202.  **                                                                             **
  203.  **        It is NOT LEGAL to call QD3D routines except Q3View_CancelRendering    **
  204.  **        inside an idler callback.                                             **
  205.  **        (Actually, we don't check for this.  But don't try it.  We'll          **
  206.  **        blow up!)                                                             **
  207.  **                                                                             **
  208.  **        Q3View_SetIdleMethod registers a callback that can be called         **
  209.  **        by the system during rendering.  Unfortunately there is no way yet     ** 
  210.  **        to set timer intervals when you want to be called.  Basically, it is **
  211.  **        up to the application's idler callback to check clocks to see if you **
  212.  **        were called back only a millisecond ago or an hour ago!                 **
  213.  **                                                                             **
  214.  *****************************************************************************/
  215.  
  216. typedef void (*TQ3ViewIdleMethod)(
  217.     TQ3ViewObject        view,
  218.     const void            *idlerData);
  219.  
  220. EXPORT TQ3Status Q3View_SetIdleMethod(
  221.     TQ3ViewObject        view,
  222.     TQ3ViewIdleMethod    idleMethod,
  223.     const void             *idleData);
  224.  
  225.  
  226. /******************************************************************************
  227.  **                                                                             **
  228.  **                            Push/Pop routines                                 **
  229.  **                                                                             **
  230.  *****************************************************************************/
  231.  
  232. EXPORT TQ3Status Q3Push_Submit(
  233.     TQ3ViewObject     view);
  234.  
  235. EXPORT TQ3Status Q3Pop_Submit(
  236.     TQ3ViewObject     view);
  237.  
  238.  
  239. /******************************************************************************
  240.  **                                                                             **
  241.  **        Check if bounding box is visible in the viewing frustum.  Transforms **
  242.  **        the bbox by the current local_to_world transformation matrix and     **
  243.  **        does a clip test to see if it lies in the viewing frustum.             **
  244.  **        This can be used by applications to cull out large chunks of scenes     **
  245.  **        that are not going to be visible.                                     **
  246.  **                                                                             **
  247.  **        The default implementation is to always return kQ3True.  Renderers     **
  248.  **        may override this routine however to do the checking.                 **
  249.  **                                                                             **
  250.  *****************************************************************************/
  251.  
  252. EXPORT TQ3Boolean Q3View_IsBoundingBoxVisible(
  253.     TQ3ViewObject            view,
  254.     const TQ3BoundingBox    *bbox);
  255.  
  256.  
  257. /******************************************************************************
  258.  **                                                                             **
  259.  **                            DrawContext routines                             **
  260.  **                                                                             **
  261.  *****************************************************************************/
  262.  
  263. EXPORT TQ3Status Q3View_SetDrawContext(
  264.     TQ3ViewObject             view,
  265.     TQ3DrawContextObject    drawContext);
  266.  
  267. EXPORT TQ3Status Q3View_GetDrawContext(
  268.     TQ3ViewObject             view,
  269.     TQ3DrawContextObject    *drawContext);
  270.  
  271.  
  272. /******************************************************************************
  273.  **                                                                             **
  274.  **                            Graphics State routines                             **
  275.  **                                                                             **
  276.  ** The graphics state routines can only be called while rendering (ie. in     **
  277.  ** between calls to start and end rendering calls).  If they are called     **
  278.  ** outside of a rendering loop, they will return with error.                 **
  279.  **                                                                             **
  280.  *****************************************************************************/
  281.   
  282. /******************************************************************************
  283.  **                                                                             **
  284.  **                            Transform routines                                  **
  285.  **                                                                             **
  286.  *****************************************************************************/
  287.  
  288. EXPORT TQ3Status Q3View_GetLocalToWorldMatrixState(
  289.     TQ3ViewObject        view,
  290.     TQ3Matrix4x4        *matrix);
  291.         
  292. EXPORT TQ3Status Q3View_GetWorldToFrustumMatrixState(
  293.     TQ3ViewObject        view,
  294.     TQ3Matrix4x4        *matrix);
  295.         
  296. EXPORT TQ3Status Q3View_GetFrustumToWindowMatrixState(
  297.     TQ3ViewObject        view,
  298.     TQ3Matrix4x4        *matrix);
  299.     
  300.  
  301. /******************************************************************************
  302.  **                                                                             **
  303.  **                            Style state routines                             **
  304.  **                                                                             **
  305.  *****************************************************************************/
  306.  
  307. EXPORT TQ3Status Q3View_GetBackfacingStyleState(
  308.     TQ3ViewObject            view,
  309.     TQ3BackfacingStyle        *backfacingStyle);
  310.  
  311. EXPORT TQ3Status Q3View_GetInterpolationStyleState(
  312.     TQ3ViewObject            view,
  313.     TQ3InterpolationStyle    *interpolationType);
  314.  
  315. EXPORT TQ3Status Q3View_GetFillStyleState(
  316.     TQ3ViewObject            view,
  317.     TQ3FillStyle            *fillStyle);
  318.  
  319. EXPORT TQ3Status Q3View_GetHighlightStyleState(
  320.     TQ3ViewObject            view,
  321.     TQ3AttributeSet            *highlightStyle);
  322.  
  323. EXPORT TQ3Status Q3View_GetSubdivisionStyleState(
  324.     TQ3ViewObject            view,
  325.     TQ3SubdivisionStyleData    *subdivisionStyle);
  326.  
  327. EXPORT TQ3Status Q3View_GetOrientationStyleState(
  328.     TQ3ViewObject            view,
  329.     TQ3OrientationStyle        *fontFacingDirectionStyle);
  330.  
  331. EXPORT TQ3Status Q3View_GetReceiveShadowsStyleState(
  332.     TQ3ViewObject            view,
  333.     TQ3Boolean                *receives);
  334.  
  335. EXPORT TQ3Status Q3View_GetPickIDStyleState(
  336.     TQ3ViewObject            view,
  337.     unsigned long            *pickIDStyle);
  338.     
  339. EXPORT TQ3Status Q3View_GetPickPartsStyleState(
  340.     TQ3ViewObject            view,
  341.     TQ3PickParts            *pickPartsStyle);
  342.  
  343. /******************************************************************************
  344.  **                                                                             **
  345.  **                        Attribute state routines                             **
  346.  **                                                                             **
  347.  *****************************************************************************/
  348.  
  349. EXPORT TQ3Status Q3View_GetDefaultAttributeSet(
  350.     TQ3ViewObject        view,
  351.     TQ3AttributeSet        *attributeSet);
  352.  
  353. EXPORT TQ3Status Q3View_SetDefaultAttributeSet(
  354.     TQ3ViewObject        view,
  355.     TQ3AttributeSet        attributeSet);
  356.  
  357.  
  358. EXPORT TQ3Status Q3View_GetAttributeSetState(
  359.     TQ3ViewObject         view,
  360.     TQ3AttributeSet        *attributeSet);
  361.  
  362. EXPORT TQ3Status Q3View_GetAttributeState(
  363.     TQ3ViewObject         view,
  364.     TQ3AttributeType    attributeType,
  365.     void                *data);
  366.  
  367. #if defined(ESCHER_VER_15) && ESCHER_VER_15
  368. /******************************************************************************
  369.  **                                                                             **
  370.  **                            Cache Routines                                      **
  371.  **                                                                             **
  372.  *****************************************************************************/
  373.  
  374. EXPORT TQ3Status Q3View_StartRenderingCache(
  375.     TQ3ViewObject        view,
  376.     unsigned long        id);
  377.  
  378. EXPORT TQ3Status Q3View_IsRenderingCacheValid(
  379.     TQ3ViewObject        view,
  380.     unsigned long        id,
  381.     TQ3Boolean            *isValid);
  382.     
  383. EXPORT TQ3Status Q3View_ClearRenderingCache(
  384.     TQ3ViewObject        view,
  385.     unsigned long        id);
  386.     
  387.     
  388. #endif    /*  ESCHER_VER_15  */
  389.     
  390. #ifdef __cplusplus
  391. }
  392. #endif    /* __cplusplus */
  393.  
  394. #endif  /*  QD3DView_h  */
  395.